<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>登录</title>
    <!--<link href="../static/css/auth.css" rel="stylesheet" type="text/css">-->
    <!--<link href="../static/css/bg.css" rel="stylesheet" type="text/css"/>-->

    <!-- 地址栏显示 -->
    <link rel="Shortcut Icon" th:href="@{/images/hospital.ico}" type="image/x-icon"/>
    <!-- 收藏栏也显示 -->
    <link rel="Bookmark" th:href="@{/images/hospital.ico}" type="image/x-icon"/>
    <link th:href="@{/css/auth.css}" rel="stylesheet" type="text/css">
    <link th:href="@{/css/bg.css}" rel="stylesheet" type="text/css"/>
    <link th:href="@{http://cdn.bootcss.com/font-awesome/4.5.0/css/font-awesome.min.css}" rel="stylesheet"
          type="text/css"/>
    <link th:href="@{/css/mcss/mcss_login.css}" rel="stylesheet">
    <link th:href="@{/xtiper/css/xtiper.css}" type="text/css" rel="stylesheet"/>
    <script th:src="@{/xtiper/js/xtiper.js}" type="text/javascript"></script>
    <link rel="stylesheet" type="text/css" th:href="@{/css/sweetalert.css}">
</head>


<body onload="getCookie();choseRole()">

<div class="lowin">
    <div class="lowin-brand">
        <img th:src="@{/images/hospitory.png}" alt="logo">
    </div>
    <div class="lowin-wrapper">
        <div class="lowin-box lowin-login">
            <div class="lowin-box-inner">
                <form>
                    <p>Login by phone</p>
                    <div class="lowin-group">
                        <label>Phone </label>
                        <input  placeholder="请输入账户手机"  id="phone" class="lowin-input">
                    </div>
                    <div class="lowin-group password-group">
                        <label>Verification Code</label>
                        <input  placeholder="请输入验证码" id="code" class="lowin-input">
                    </div>

                    <div class="lowin-group">

                        <button class="xbutton" id="sendMessageCode">发送验证码</button>

                    </div>

                    <input id="loginId" type="button" style="text-align: center" class="lowin-btn login-btn"
                           value="登&emsp;录" onclick="dologin()">

                    <div class="text-foot">
                        &emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;
                        &emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;
                        &emsp;&emsp;&emsp;&emsp;<a th:href="@{/admin/login}" class="register-link">返回</a>
                    </div>
                </form>
            </div>
        </div>
    </div>

    <footer class="lowin-footer">
        Design By sen --<a href="https://mail.qq.com/" target="_blank" title="xue.sen@qq.com">xue.sen@qq.com</a>.
    </footer>


</div>


<script type="text/javascript" th:src="@{/js/jquery-3.3.1.min.js}"></script>
<script type="text/javascript" th:src="@{/js/auth.js}"></script>
<script type="text/javascript" th:src="@{/js/jquery.cookie.js}"></script>
<script type="text/javascript" th:src="@{/js/jquery.base64.js}"></script>
<script type="text/javascript" th:src="@{/js/sweetalert-dev.js}"></script>
<script type="text/javascript" th:src="@{/js/mjs/mjs_login.js}"></script>
</body>

<script>

    $("#sendMessageCode").click(function () {
        var phone = $("#phone").val();
        $.post("/admin/sendCode", {"phone": phone} , function (data) {
          if(data.state=200){
              xtip.msg(data.message, {icon: 's'});
          }else{
              xtip.msg(data.message, {icon: 'e'});
          }
        });
    });
    function dologin() {
        var phone = $("#phone").val();
        var code = $("#code").val();
        var param = {"phone":phone,"code":code};
        $.post("/admin/doLoginByPhone",param,function (data) {
            if(data.state==200){
                xtip.msg(data.message, {icon: 's'});
                location.href="/admin/toMain";
            }
            else{
                xtip.msg(data.message, {icon: 'e'});
            }
        })
    }
</script>
</html>